/*
 * test file
 */

#include <stdio.h>
#include <stdlib.h>

#include "random_test.h"
#include "random_test2.h"
#include "ctor_dtor_test.h"
#include "trace_test.h"

int main(int argc, char** argv)
{
    int per_test_time = 1, i = 0;
    FILE* fp1 = 0;

    if (argc>1)
    {
        per_test_time = atoi(argv[1]);
    }

    // run random test
    printf ("------------------------------\n");
    printf ("goning to run random test part one\n");
    printf ("------------------------------\n");
    fp1 = fopen("test_random1","w");
    fclose(fp1);
    for (i =0; i<per_test_time; ++i)
    {
        run_random_test();
    }
    printf ("------------------------------\n");

    // run random test 2
    printf ("goning to run random test part two\n");
    printf ("------------------------------\n");
    fp1 = fopen("test_random2","w");
    fclose(fp1);
    for (i =0; i<per_test_time; ++i)
    {
        run_random_test2();
    }
    printf ("------------------------------\n");

    // run constructor and destructor test
    printf ("goning to run constructor and destructor test\n");
    printf ("------------------------------\n");
    fp1 = fopen("test_ctor_dtor","w");
    fclose(fp1);
    for (i =0; i<per_test_time; ++i)
    {
        run_ctor_dtor_test();
    }
    printf ("------------------------------\n");

    // run trace test
    printf ("goning to run trace test\n");
    printf ("------------------------------\n");
    fp1 = fopen("test_trace","w");
    fclose(fp1);
    for (i =0; i<per_test_time; ++i)
    {
        printf("\n*** round %d ***\n\n", i+1);
        run_trace_test();
    }
    printf ("------------------------------\n");

    return 0;
}
